<template>
  <div>
    <div>
      <el-row>
        <el-col :xs="24" :sm="10" :md="10" :lg="10" :xl="10">
          <div class="detail_info">
            <div style="margin: 25px 20px 0px 25px">
              <img :src="info.zxlogo" alt="" style="
                  width: 58px;
                  height: 58px;
                  border: 1px solid #cbc5c5;
                  border-radius: 8px;
                " />
            </div>
            <div style="margin-top: 16px;">
              <span class="detail_title">{{ info.nickname }}</span>
              <div class="detail_text">
                <span>{{ info.mini_version }}</span>
              </div>
            </div>
          </div>
        </el-col>
        <el-col :xs="24" :sm="14" :md="14" :lg="14" :xl="14">
          <div class="but_count">
            <el-button type="button" class="preview" @click="centerDialogVisible1 = true">自助签名</el-button>
            <el-button type="button" class="merge" @click="centerDialogVisible2 = true">秘钥开通</el-button>
            <el-button type="button" class="upnew" @click="goBuyUrl('/mealPay','mealPay',100,1)">在线开通</el-button>
          </div>
        </el-col>
      </el-row>
    </div>
    <table class="table" style="margin-top: 43px">
      <thead>
        <tr>
          <th>
            <div class="title">
              签名状态：<span style="color: #ff7226">未签名</span>
            </div>
          </th>
        </tr>
        <tr>
          <th>
            <div class="title">
              应用在线自助企业签名：<span style="color: #ff7226"></span>
            </div>
          </th>
        </tr>
        <tr>
          <th>
            <div class="title">
              到期时间：<span style="color: #ff7226">尚未开通</span>
            </div>
          </th>
        </tr>
      </thead>
    </table>
    <!-- 自助签名弹窗 -->
    <el-dialog title="自助签名" :visible.sync="centerDialogVisible1" width="30%" center>
      <div class="hint">
        <div>
          <p>温馨提示:APP名称、APP的ID、APP的版本号暂不支持免费修改，请关注</p>
          <p>签名免费，无需密钥，无需支付，无时间锁，签名后自动分发安装</p>
        </div>
      </div>
      <div style="margin: 20px 41px 30px 41px">
        <el-form :model="infoObject" class="demo-ruleForm" :label-position="labelPosition" label-width="80px">
          <el-form-item label="APP名称" prop="">
            <el-input placeholder="" v-model="infoObject.nickname"></el-input>
          </el-form-item>
          <el-form-item label="APP包ID" prop="">
            <el-input v-model="info.appID"></el-input>
          </el-form-item>
          <el-form-item label="APP版本" prop="">
            <el-input v-model="info.versions"></el-input>
          </el-form-item>
          <el-form-item label="描述" prop="">
            <div style="
                border: 1px solid #dcdfe6;
                border-radius: 4px;
                height: 40px;
              ">
              <el-button class="file_button" icon="el-icon-document-copy" style="background-color:#9CC3FF;" size="small"
                @click="checkFile()">点击选择</el-button>
              <span class="fileName">{{ fileName }}</span>
              <input type="file" class="fileinput" style="display: none" @change="checkFileSure()" />
            </div>
          </el-form-item>
          <el-form-item label="证书" prop="">
            <div style="
                border: 1px solid #dcdfe6;
                border-radius: 4px;
                height: 40px;
              ">
              <el-button class="file_button" icon="el-icon-document-copy" style="background-color:#9CC3FF;" size="small"
                @click="checkFileOne()">点击选择</el-button>
              <span class="fileName">{{ fileNameOne }}</span>
              <el-input type="file" id="fileinput" style="display: none" clearable @change="checkFileSureOne()">
              </el-input>
            </div>
          </el-form-item>
          <el-form-item label="证书密码" prop="">
            <el-input v-model="info.passWord"></el-input>
          </el-form-item>
        </el-form>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="centerDialogVisible1 = false">取 消</el-button>
        <el-button type="primary" @click="centerDialogVisible1 = false">开始签名</el-button>
      </span>
    </el-dialog>
    <!-- 秘钥开通弹窗 -->
    <el-dialog title="秘钥开通" :visible.sync="centerDialogVisible2" width="30%" center>
      <div style="margin: 20px 41px 30px 41px">
        <el-form :label-position="labelPosition" label-width="80px">
          <el-input></el-input>
        </el-form>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button @click="centerDialogVisible2 = false">取 消</el-button>
        <el-button type="primary" @click="centerDialogVisible2 = false">确 定</el-button>
      </span>
    </el-dialog>
  </div>
</template>

<script>
  import filters from "../../../utils/filters";
  export default {
    //import引入的组件需要注入到对象中才能使用
    components: {},
    filters: filters,
    data() {
      //这里存放数据
      return {
        appUrl: "../../../static/App图标.png",
        info: [],
        centerDialogVisible1: false,
        centerDialogVisible2: false,
        labelPosition: "right",
        fileName: "",
        fileNameOne: "",
        infoObject: {
          nickname: "",
          appID: "",
          versions: "",
          describe: "12",
          certificate: "",
          passWord: "",
        },
        appID:''
      };
    },
    //监听属性 类似于data概念
    computed: {},
    //监控data中的数据变化
    watch: {
    },
    //方法集合
    methods: {
      getList() {
        var params = new URLSearchParams();
        params.append("appid", this.$route.query.appID);
        this.$post(this.API.Application_detail, params).then((res) => {
          let data = res.data;
          this.info = data.info;
        });
      },
      goUrl(path, name) {
        sessionStorage.setItem("currentTab", "first");
        this.$router.push({
          path: path,
          name: name,
        });
      },
      goBuyUrl(path, name, code, type) {
        this.$router.push({
          path: path,
          name: name,
          query: {
            code: code,
            type: type,
            appID:this.$route.query.appID
          },
        });
      },
      checkFile() {
        var a = $(".fileinput").click();
      },
      checkFileSure(val) {
        this.fileName = document.querySelector(".fileinput").files[0].name;
      },
      checkFileOne() {
        var a = $("#fileinput").click();
      },
      checkFileSureOne(val) {
        this.fileNameOne = document.getElementById("fileinput").files.name;
      }
    },
    //生命周期 - 创建完成（可以访问当前this实例）
    created() {
      this.getList();
    },
    //生命周期 - 挂载完成（可以访问DOM元素）
    mounted() {},
  };

</script>
<style scoped>
  .title {
    font-size: 14px;
    font-family: PingFangSC-Regular, PingFang SC;
    font-weight: 400;
    color: #000000;
    line-height: 14px;
  }

  .hint {
    width: 100%;
    height: 60px;
    background: #e81c1c;
    display: flex;
    justify-content: center;
    align-items: center;
  }

  .hint p {
    font-size: 12px;
    font-family: PingFangSC-Regular, PingFang SC;
    font-weight: 400;
    color: #ffffff;
    line-height: 12px;
  }

  .orderHeader {
    display: flex;
    justify-content: space-between;
    height: 80px;
    padding: 18px 20px;
  }

  .flexJustifyStart {
    display: flex;
    justify-content: start;
    align-items: center;
  }

  .block>>>.el-date-editor .el-range__icon {
    margin-left: -5px !important;
    line-height: 18px !important;
  }

  .orderHeader>>>.el-form-item__content {
    line-height: 40px !important;
  }

  .flexAlginCenter {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 20px;
    width: 100%;
  }

  .orderBody {
    height: 550px;
  }

  div>>>.el-card {
    border: none;
  }

  div>>>.el-progress-bar {
    width: 200px;
  }

  /* 按钮 */
  .buy {
    background: -webkit-linear-gradient(-135deg, #ff9d68, #ff7226);
    background: -o-linear-gradient(-135deg, #ff9d68, #ff7226);
    background: -moz-linear-gradient(-135deg, #ff9d68, #ff7226);
    background: linear-gradient(-135deg, #ff9d68, #ff7226);
    color: #fff;
    font-size: 16px;
  }

  .cell span {
    width: 1px;
    /*根据自己项目进行定义宽度*/
    overflow: hidden;
    /*设置超出的部分进行影藏*/
    text-overflow: ellipsis;
    /*设置超出部分使用省略号*/
    white-space: nowrap;
    /*设置为单行*/
  }

  .box1 {
    width: 100px;
    height: 50px;
    display: flex;
    justify-content: center;
    flex-direction: column;
    align-items: center;
    /* border-right: 1px solid #E0E0E0; */
  }

  .box1:first-child {
    border-right: 1px solid #e0e0e0;
  }

  .box2 {
    margin: 0px 20px;
  }

  .detail_info {
    display: flex;
    flex-direction: row;
    align-items: center;
  }

  .detail_title {
    width: 36px;
    height: 18px;
    font-size: 18px;
    font-family: PingFang-SC-Medium, PingFang-SC;
    font-weight: 500;
    color: #000000;
  }

  .detail_text {
    height: 12px;
    font-size: 12px;
    font-family: PingFangSC-Regular, PingFang SC;
    font-weight: 400;
    color: #cbc5c5;
    margin-top: 5px;
  }

  .detail_text span:first-child {
    margin-left: 0px;
  }

  .detail_text span {
    margin-left: 22px;
  }

  .table>thead>tr>th {
    padding: 8px 0px 30px 30px !important;
    border: none;
  }

.preview,
  .merge {
    border: 2px solid #ff7226;
    color: #ff7226;
  }
  .preview:hover,.merge:hover{
    background-color: #ff7226;
    color: #fff;
  }

.upnew {
    border: 2px solid #167df1;
    background-color: #167df1;
    color: #fff;
}
.upnew:hover {
    border: 2px solid #167df1;
    background-color: #fff;
    color: #167df1;
}

  div>>>.el-dialog--center .el-dialog__body {
    text-align: center;
    padding: 0px;
  }

  .file_button {
    padding: 14px 10px;
    position: absolute;
    left: 0px;
    top: -1px;
    color: #fff
  }

  .fileName {
    position: absolute;
    left: 100px;
  }

  div>>>input[type="file"] {
    display: none;
  }

  .but_count {
    display: flex;
    justify-content: flex-end;
    margin-right: 20px;
    margin-top: 30px;
  }

  /* 媒体查询 */
  @media (max-width: 768px) {
    .but_count {
      display: flex;
      justify-content: flex-start;
      margin-left: 30px;
      margin-bottom: -20px;
    }
  }
  @media (max-width: 576px) {
    .but_count {
      display: flex;
      justify-content: flex-start;
      margin-left: 28px;
      margin-bottom: -20px;
    }
     
  }

  @media (max-width: 414px) {
    .but_count {
      display: flex;
      justify-content: center;
      margin-bottom: -20px;
      margin-left: -20px;
    }
    .el-button{
      padding: 8px 15px;
    }

  }
  @media (max-width: 375px) {
    .but_count {
      
      margin-bottom: -20px;
      margin-left: 20px;
    }
    .el-button{
      padding: 8px 15px;
    }
    .detail_text{
      font-size: 12px;
    }

  }

</style>
